<template>
  <div style="padding: 16px;">
    <h2 style="margin-bottom: 12px;">订单管理</h2>
    <a-table :data-source="orders" :pagination="false" row-key="id" size="small">
      <a-table-column title="ID" dataIndex="id" key="id" width="80" />
      <a-table-column title="酒店ID" dataIndex="hotelId" key="hotelId" width="100" />
      <a-table-column title="房间ID" dataIndex="roomId" key="roomId" width="100" />
      <a-table-column title="状态" dataIndex="status" key="status" width="120" />
      <a-table-column title="入住" dataIndex="checkinDate" key="checkinDate" width="140" />
      <a-table-column title="退房" dataIndex="checkoutDate" key="checkoutDate" width="140" />
      <a-table-column title="金额" dataIndex="amount" key="amount" width="120" />
      <a-table-column title="创建时间" dataIndex="createdAt" key="createdAt" width="180" />
    </a-table>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { orderAPI } from '@/api/order'

const orders = ref([])

const load = async () => {
  try {
    // 后台订单管理：不传 userId，拉取全部订单
    const res = await orderAPI.list(undefined)
    const payload = res.data?.data || res.data || []
    orders.value = Array.isArray(payload) ? payload : (payload.list || [])
  } catch (e) {
    // 忽略
  }
}

onMounted(() => load())
</script>

<style scoped>
</style>


